package com.metadata_system.common.db.entity;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Random;
import javax.persistence.*;

import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Table(name = "md_access_provider")
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class AccessProvider {
    @Id
    private Integer id;

    /**
     * 供应商名称
     */
    private String name;

    /**
     * 供应商
     */
    @Column(name = "short_name")
    private String shortName;

    /**
     * api-key用于请求api
     */
    @Column(name = "api_key")
    private String apiKey;

    /**
     * api-key用于请求秘钥
     */
    @Column(name = "api_secret")
    private String apiSecret;

    /**
     * 状态: 0.未启用 1.启用中
     */
    private Integer status;

    /**
     * 允许访问ip列表(如果不设置，则就是允许所有)
     */
    @Column(name = "ip_list")
    private String ipList;

    /**
     * 会员端-h5-访问域名
     */
    @Column(name = "h5_doname")
    private String h5Doname;

    /**
     * 会员端-pc-访问域名
     */
    @Column(name = "pc_doname")
    private String pcDoname;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(name = "created_time")
    private Date createdTime;

    public static void main(String[] args) {
        for (int j = 0; j < 10; j++) {
            List<Integer> list = new ArrayList<>();
            for (int i = 0; i < 12; i++) {
                Random random = new Random();
                int randomNum = random.nextInt(2000)+200;
                list.add(randomNum);
            }
            System.out.println(JSON.toJSONString(list));
        }
    }
}
